package com.shouhuobao.take.active;

import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import com.iseastar.BaseActivity2;
import com.iseastar.guojiang.BaseFragment;
import com.shouhuobao.station.R;
import com.shouhuobao.take.utils.AppTab;

import droid.frame.view.ViewPagerExt;

/**
 * Created by joker on 2017/9/21.
 * 活动页面主activity
 */
public class ActiveMainActivity extends BaseActivity2 {

    private ViewPagerExt mViewPager = null;
    private BaseFragment mFragment1, mFragment2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void findViewById() {
        setContentView(R.layout.activity_active_main);
        super.findViewById();
        getAppTitle().setCommonTitle("活动");
        TextView[] mTags = new TextView[2];
        mTags[0] = (TextView) findViewById(R.id.activing_tv);
        mTags[1] = (TextView) findViewById(R.id.active_history_tv);
        mViewPager = (ViewPagerExt) findViewById(R.id.viewpager);

        ImageView mImgLine = (ImageView) findViewById(R.id.active_line_img);

        initFragment();

        mViewPager.setFragmentItems(getSupportFragmentManager(), mFragment1, mFragment2);
        mViewPager.setSupportScroll(true);
        AppTab appTab = new AppTab(getContext(), 0);
        appTab.initPosition(mViewPager, mImgLine, mTags);
        mViewPager.setOffscreenPageLimit(2);

    }

    private void initFragment() {
        mFragment1 = new Active1Fragment();
        Bundle bundle1 = new Bundle();
        bundle1.putInt("type", 0);
        mFragment1.setArguments(bundle1);
        //
        Bundle bundle2 = new Bundle();
        bundle2.putInt("type", 1);
        mFragment2 = new Active2Fragment();
        mFragment2.setArguments(bundle2);
    }
}
